<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body style="padding-top:0px;margin-top:0px;background-color:#ddd;">
<%! int i=1; %>
<div style="text-align:center;width:80%;position: fixed;margin-top: -68px;"><h2 id="timer"></h2></div>
<div style="margin:auto;height:auto;width:1200px;background-color:GhostWhite;padding-top:15px;margin-top:0px">


<div style="text-align:center;width:100%">

	<h1 style="padding-top:20px;">考试科目：${exam.name }</h1>
</div>
<h5>考试时间:${exam.totalTime }分钟&nbsp&nbsp&nbsp&nbsp试题总分：${exam.totalScore }分</h5>


<form:form action="${pageContext.request.contextPath}/StudentTestGrade" method="post">


<input id="subjectId" name="subjectId" type="hidden" value="${exam.subId }"/>
<input id="time"  type="hidden" value="${exam.totalTime }"/>


<c:forEach items="${ExamTestList }" var="list">
		<c:if test="${list.examTestType.testType == '单选题'}">
			<table>
				<tr>
					<td><h3><%=i %>、</h3></td><td><h3>${list.content }（${list.examTestType.testType }）${list.examTestType.testTypeScore }分</h3></td>
				</tr>
				<tr>
					<td>A.</td><td><h4><input type="radio" name="${list.id }" value="A" />${list.chooseA }</h4></td>
				</tr>
				<tr>
					<td>B.</td><td><h4><input type="radio" name="${list.id }" value="B" />${list.chooseB }</h4></td>
				</tr>
				<tr>
					<td>C.</td><td><h4><input type="radio" name="${list.id }" value="C" />${list.chooseC }</h4></td>
				</tr>
				<tr>
					<td>D.</td><td><h4><input type="radio" name="${list.id }" value="D" />${list.chooseD }</h4></td>
				</tr>
			</table>
			<hr>
			<input type="hidden" value="<%=i++ %>"/>
		</c:if>
		<c:if test="${list.examTestType.testType == '多选题'}">
			<table>
				<tr>
					<td><h3><%=i %>、</h3></td><td><h3>${list.content }（${list.examTestType.testType }）${list.examTestType.testTypeScore }分</h3></td>
				</tr>
				<tr>
					<td>A.</td><td><h4><input type="checkbox" name="${list.id }" value="A" />${list.chooseA }</h4></td>
				</tr>
				<tr>
					<td>B.</td><td><h4><input type="checkbox" name="${list.id }" value="B" />${list.chooseB }</h4></td>
				</tr>
				<tr>
					<td>C.</td><td><h4><input type="checkbox" name="${list.id }" value="C" />${list.chooseC }</h4></td>
				</tr>
				<tr>
					<td>D.</td><td><h4><input type="checkbox" name="${list.id }" value="D" />${list.chooseD }</h4></td>
				</tr>
			</table>
			<hr>
			<input type="hidden" value="<%=i++ %>"/>
		</c:if>
		
	</c:forEach>
<div style="text-align:center;width:100%;height:50px"><input style="margin-top:10px;height:30px;background-color:#286090" type="submit" value="提交试卷" onclick="isSubmit()"></div>
</form:form>
<input type="hidden" value="<%=i=1 %>"/>

</div>
<script src='${pageContext.request.contextPath}/static/assets/js/jquery.min.js'></script>
<script type="text/javascript">
	function isSubmit() {
		if (!confirm("确认提交试卷？")) {
			window.event.returnValue = false;
		}
	}
	
	var maxtime = $("#time").val()*60 //1小时，按秒计算   
	function CountDown(){   
	if(maxtime>=0){   
		minutes = Math.floor(maxtime/60);   
		seconds = Math.floor(maxtime%60);   
		msg = "距离考试结束还有："+minutes+"分"+seconds+"秒";   
		document.all["timer"].innerHTML=msg;   
		if(maxtime == 5*60) alert('注意，还有5分钟!');   
			--maxtime;   
		}else{   
			clearInterval(timer);   
			alert("时间到，活动已结束!");   
		}   
	}   
	timer = setInterval("CountDown()",1000);   
</script>
</body>
</html>